/*
 * @Description:
 * @Autor: HuiSir<273250950@qq.com>
 * @Date: 2023-07-04 10:31:57
 * @LastEditTime: 2024-05-16 15:48:47
 */
import "./header.js";
import "./footer.js";

// 展开分类
(function () {
  document.querySelector(".myArchive").addEventListener("click", (e) => {
    if (e.target.localName == "span" && e.target.classList.contains("title")) {
      const $li = e.target.parentElement;
      const $childUl = $li.querySelector("ul");

      if ($childUl.style.maxHeight === "1000px") {
        $childUl.style.maxHeight = "0";
        $childUl.style.overflowY = "hidden";
        $li.classList.remove("show");
      } else {
        $childUl.style.maxHeight = "1000px";
        $li.classList.add("show");
        setTimeout(() => {
          $childUl.style.overflowY = "auto";
        }, 300);
      }
    }
  });

  document.querySelector(".myArchive .archives-by-month p.collapse>a").onclick = (e) => {
    document.querySelectorAll('.myArchive .archives-by-month span.title').forEach(span=>span.click());
  };
})();
